package cn.com.dbappsecurity.utils;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.log4j.Logger;
/**
 * mybatis工具类
 * @author dhz
 */
public class MybatisUtil {

	private static final Logger LOG = Logger.getLogger(MybatisUtil.class);
	public static SqlSessionFactory sqlSessionFactory = null;
	
	private MybatisUtil(){}
	
	static{
		//创建mybatis SqlSessionFactory实例
		try {
			sqlSessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader("SqlMapConfig.xml"));
		} catch (Exception e) {
			LOG.error("创建mybatis SqlSessionFactory实例出错",e);
		}
	}
	
}
